<template>
  <div class="shoperInfoAlter">
    <div class="shoperInfoAlter-con">
      <h4>更换手机号码</h4>
      <div class="phoneNum">
        <div class="currentPhoneNum">
          当前绑定手机号码为: 1367*****23
        </div>
        <div class="newPhoneNum">
          请输入新的手机号码:
          <el-input
            type="text"
            placeholder="请输入新的手机号码"
            v-model="newPhoneNum">
          </el-input>
          <getValidCode @commitValidCode="doValidCode" :phone-num="newPhoneNum"></getValidCode>
          <p v-show="showTips" ref="sendTips" class="sendTips">系统已经发送验证码到你的手机上，请查看你的手机短信。</p>
        </div>
        <div class="validCode-wrap">
          收到的验证码:
          <el-input
            class="ValidCode"
            type="text"
            placeholder="验证码"
            v-model="ValidCode">
          </el-input>
        </div>
        <el-button round type="success">提交更改</el-button>
      </div>
    </div>
  </div>
</template>

<script>
import getValidCode from '../Common/getValidCode'
export default {
  name: 'ShoperInfoAlter',
  data () {
    return {
      newPhoneNum: '',
      ValidCode: '',
      showTips: false
    }
  },
  components: {
    getValidCode
  },
  methods: {
    doValidCode (code) {
      if (code === '404') {
        this.$refs.sendTips.innerHTML = '手机号码不能为空'
      } else if (code === '403') {
        this.$refs.sendTips.innerHTML = '手机号码输入非法'
      } else if (code === '200') {
        this.$refs.sendTips.innerHTML = '系统已经发送验证码到你的手机，请注意查收'
      }
      this.showTips = true
    }
  }
}
</script>

<style lang="stylus" scoped>
  @import "../../assets/css/base.styl"
  .shoperInfoAlter
    width: $width
    margin: 0 auto
    padding-left: 170px
    box-sizing border-box
    background-color: #fff
    min-height 800px
    h4
      font-weight 400
      color: #666
      font-size 18px
      padding-top 20px
    .phoneNum
      padding-left 100px
      box-sizing border-box
      margin: 20px 0
      color: #666
      >div
        margin: 20px 0
      .el-input
        width: 200px
      .ValidCode
        width: 100px
      .newPhoneNum
        .sendTips
          font-size 14px
          color: #bbb
          margin: 10px 20px
      .el-button
        margin 40px 0 0 200px
</style>
